use crate::{
    enter_syscall,
    syscall::{SYS_CLOSE, SYS_FSTAT, SYS_OPEN, SYS_READ, SYS_WRITE},
};

pub fn open(path: *const i8, mode: i32) -> usize {
    enter_syscall(path as usize, mode as usize, 0, 0, 0, 0, SYS_OPEN)
}

pub fn close(fd: usize) {
    enter_syscall(fd, 0, 0, 0, 0, 0, SYS_CLOSE);
}

pub fn read(fd: usize, buf: usize, size: usize) -> usize {
    enter_syscall(fd, buf, size, 0, 0, 0, SYS_READ)
}

pub fn write(fd: usize, buf: usize, size: usize) -> usize {
    enter_syscall(fd, buf, size, 0, 0, 0, SYS_WRITE)
}

pub fn fstat(fd: usize, stat: usize) -> usize {
    enter_syscall(fd, stat, 0, 0, 0, 0, SYS_FSTAT)
}
